Skip to content

tests: verify pcap_filename on alert and flow events - v2#2932

Open
oferda4 wants to merge 1 commit intoOISF:masterfrom
oferda4:test/eve-pcap-filename-alert-and-flow
Open

tests: verify pcap_filename on alert and flow events - v2#2932
oferda4 wants to merge 1 commit intoOISF:masterfrom
oferda4:test/eve-pcap-filename-alert-and-flow

Conversation

@oferda4
Copy link
Contributor

@oferda4 oferda4 commented Feb 21, 2026

Add a regression test that checks the pcap_filename field is present and correct in EVE JSON output for both alert events (packet-based) and flow events (non-packet-based).

These two code paths use different sources for the filename in OutputJsonBuilderBuffer: per-packet pfv->filename when a packet is available, and the global PcapFileGetFilename() fallback for flow/netflow events where no packet exists.

Previous PR: #2927

v2:
- Fix recursive test and readme.

Redmine ticket: https://redmine.openinfosecfoundation.org/issues/5255
Suricata PR: OISF/suricata#14868

Add three suricata-verify tests that together cover all code paths in
the pcap_filename output for pcap-file mode:

pcap-filename-alert-and-flow: single pcap, verifies pcap_filename is
present in alert events (p != NULL path in OutputJsonBuilderBuffer) and
flow events (p == NULL, falls back to FlowGetPcapFileVars).

pcap-filename-pseudo-pkts: verifies pcap_filename is present in fileinfo
events generated by stream pseudo-packets (PKT_SRC_STREAM_TCP_DETECTLOG_FLUSH),
which carry pcap_v.pfv propagated from the flow.

pcap-filename-recursive: two pcap files fed with --pcap-file-recursive.
alert.pcap is processed first; http.pcap is processed last. Verifies that
the flow event for the alert.pcap connection still reports alert.pcap
(via the per-flow pfv), not the stale global that has advanced to http.pcap.
This is the primary race-condition regression test for #5255.

Ticket: #5255
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

requires suricata pr Depends on a PR in Suricata

Development

Successfully merging this pull request may close these issues.

2 participants